package com.woniu.inlet.web.command;

import com.woniu.utils.ApplicationContextHolder;
import lombok.Data;

import java.math.BigDecimal;

@Data
public class VerifyBalanceCommand {
    private Integer id;
    private BigDecimal payMoney;
    private Integer fixedId;
    private VerifyBalanceCommandHandler handler;

    public VerifyBalanceCommand() {
        handler = ApplicationContextHolder.getApplicationContext().getBean(VerifyBalanceCommandHandler.class);
    }

    public VerifyBalanceCommand(Integer id, BigDecimal payMoney, Integer fixedId) {
        this();
        this.id = id;
        this.payMoney = payMoney;
        this.fixedId = fixedId;
    }

    public boolean execute() {
        return handler.verifyBalance(this);
    }

}
